package com.ias.agdis_r.util;

import java.util.HashMap;
import java.util.Map;

import android.view.KeyEvent;

/**
 * 键码管理
 * 
 * @author wanghu
 * 
 */
public class KeyEventUtils {
	public static final int KEY_0 = KeyEvent.KEYCODE_0;
	public static final int KEY_1 = KeyEvent.KEYCODE_1;
	public static final int KEY_2 = KeyEvent.KEYCODE_2;
	public static final int KEY_3 = KeyEvent.KEYCODE_3;
	public static final int KEY_4 = KeyEvent.KEYCODE_4;
	public static final int KEY_5 = KeyEvent.KEYCODE_5;
	public static final int KEY_6 = KeyEvent.KEYCODE_6;
	public static final int KEY_7 = KeyEvent.KEYCODE_7;
	public static final int KEY_8 = KeyEvent.KEYCODE_8;
	public static final int KEY_9 = KeyEvent.KEYCODE_9;
	
	public static final int KEY_UP = KeyEvent.KEYCODE_DPAD_UP;//上
	public static final int KEY_DOWN = KeyEvent.KEYCODE_DPAD_DOWN;//下
	public static final int KEY_LEFT = KeyEvent.KEYCODE_DPAD_LEFT;//左
	public static final int KEY_RIGHT = KeyEvent.KEYCODE_DPAD_RIGHT;//右
	
	public static final int KEY_CAMERA = KeyEvent.KEYCODE_CAMERA;//拍照功能健
	
	public static final int KEY_FUNCTION_LEFT = KeyEvent.KEYCODE_BUTTON_X;//左功能健
	public static final int KEY_FUNCTION_RIGHT = KeyEvent.KEYCODE_BUTTON_Y;//右功能健
	
	public static final int KEY_STAR = KeyEvent.KEYCODE_STAR;//*
	public static final int KEY_WELL = KeyEvent.KEYCODE_POUND;//#
	public static final int KEY_JIANPAN = KeyEvent.KEYCODE_BACK;//
//	public static final int KEY_JIETING = KeyEvent.KEYCODE_CALL;//
	public static final int KEY_GUADUAN = KeyEvent.KEYCODE_ENDCALL;//
	public static final int KEY_OK = KeyEvent.KEYCODE_DPAD_CENTER;//ok
//	public static final int KEY_DUIJIANG = KeyEvent.KEYCODE_SEARCH;//Enter键:DVT对讲测试
	public static final int KEY_SAOMIAO = KeyEvent.KEYCODE_BUTTON_A;//侧键3:扫描
	public static final int KEY_DUIJIANG = KeyEvent.KEYCODE_BUTTON_B;//侧键4:PVT对讲
	public static final int KEY_SCAN_DUIJIANG = 101;
	public static final int KEY_SCAN_ERJI = 226;
	public static final int KEY_ENTER = KeyEvent.KEYCODE_SEARCH;//
	public static final int KEY_MENU = KeyEvent.KEYCODE_MENU;//MENU
//	public static final int KEY_FUNCTION_BACK = KeyEvent.KEYCODE_BACK;//返回键

	public static final int KEY_HOME = KeyEvent.KEYCODE_HOME;//HOME键
	
	private static Map<Integer, Integer> keyMap = new HashMap<Integer, Integer>();

	static {
		keyMap.put(KEY_0, 0);
		keyMap.put(KEY_1, 1);
		keyMap.put(KEY_2, 2);
		keyMap.put(KEY_3, 3);
		keyMap.put(KEY_4, 4);
		keyMap.put(KEY_5, 5);
		keyMap.put(KEY_6, 6);
		keyMap.put(KEY_7, 7);
		keyMap.put(KEY_8, 8);
		keyMap.put(KEY_9, 9);
	}

	public static Integer getKey(Integer keyCode) {
		return keyMap.get(keyCode);
	}

}
